/**
 * Author: Zane
 * Email: 873934580@qq.com
 * Date: 2023/6/25
 */
import type { RouteRecordRaw } from 'vue-router'

// 默认的布局路由前缀
export const DEFAULT_ROUTE_PREFIX = 'admin'

/**
 * 默认路由表
 */
export const defaultRoute: RouteRecordRaw[] = [
    {
        name: 'login',
        path: '/login',
        meta: { auth: false },
        component: () => import('@/pages/login/index.vue'),
    },
    {
        path: '/:pathMatch(.*)*',
        name: 'NotFound',
        component: () => import('@/pages/common/404.vue'),
    },
    {
        // 后台找不到页面了-可能是路由未加载上
        path: `/${DEFAULT_ROUTE_PREFIX}:path(.*)*`,
        redirect: (to) => {
            return { name: DEFAULT_ROUTE_PREFIX, query: { url: to.path, query: JSON.stringify(to.query) } }
        },
    },
]
